package comtest.mongodb.mapper;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.NoRepositoryBean;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author: yxzhang23
 * @time: 2021/5/11
 */
@NoRepositoryBean
public interface OMongoRepository<T, ID extends Serializable> extends MongoRepository<T, Serializable> {

    List<T> search(MongoCriteria criteria);

    Stream<T> stream(MongoCriteria criteria);

    Page<T> search(MongoCriteria criteria, Pageable pageable);

    MongoCriteria getBuilder();

    long updateMulti(MongoCriteria criteria, Update update);

    long updateFirst(MongoCriteria criteria, Update update);

    long upsert(MongoCriteria criteria, Update update);

}
